//
// Created by weslywang on 2020/5/1.
//

#include "../common/common.h"

int maxProfit(vector<int> &prices) {
    int res=0, buy=INT_MAX;
    for(int price : prices) {
        buy = min(buy, price);
        res = max(res, price-buy);
    }
    return res;
}

int main() {
    Common common;
    vector<vector<int>> data = common.loadData();
    for (int i = 0; i <= data.size(); i++) {
        maxProfit(data[i]);
        cout << "**************" << endl;
    }
    return 0;
}